package org.springframework.boot.autoconfigure.netty.security;

import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.credential.CredentialsMatcher;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.netty.support.JwtUtils;
import org.springframework.boot.autoconfigure.netty.support.RsaUtils;


public class JwtCredentialsMatcher implements CredentialsMatcher {
 
	private Logger logger = LoggerFactory.getLogger(this.getClass());
 
	/**
	 * JwtCredentialsMatcher只需验证JwtToken内容是否合法
	 */
	@Override
	public boolean doCredentialsMatch(AuthenticationToken authenticationToken, AuthenticationInfo authenticationInfo) {

		return true;
	/*	String accessToken = authenticationToken.getCredentials().toString();
		try {
			return JwtUtils.validatorToken(accessToken,RsaUtils.getPublicKey("rsa/id_rsa.pub"));
		} catch (Exception e) {
			throw new AuthenticationException("Token expired or publicKey not found.");

		}*/
	}
 
}